import { copy } from 'fs-extra';
import { join } from 'path';

import { runTask } from '../common';
import type { Config } from '../definitions';

export async function updateOhos(config: Config): Promise<void> {
  await runTask('Updating HarmonyOS plugins', async () => {
    // 更新鸿蒙插件
    const pluginsDir = join(config.ohos.platformDirAbs, 'capacitor-cordova-ohos-plugins');
    await copy(config.cli.assets.ohos.cordovaPluginsTemplateArchiveAbs, pluginsDir);
  });
}